package system.student.mapper;

import org.apache.ibatis.annotations.*;
import system.student.entity.Clazz;

import java.util.List;

public interface ClazzMapper {

    @Insert("insert into clazz(class_name,teacher_id) values(#{className},#{teacherId})")
    void addClazz(@Param("className")String className,@Param("teacherId") Long teacherId);


    @Delete("delete from clazz where class_name=#{className}")
    void deleteClazz(@Param("className")String className);

    @Select("select * from clazz")
    List<Clazz> selectAllClazz();

    @Update("update clazz set class_name=#{className},teacher_id=#{teacherId} where id=#{clazzId}")
    void changeClazz(@Param("clazzId") Long clazzId,@Param("className")String className, @Param("teacherId")Long teacherId);

    @Select("select * from clazz where class_name=#{className}")
    String selectByClassName(@Param("className")  String className);

    @Select("select name from teacher where id=#{teacherId}")
    String selectByTeacherId(@Param("teacherId") Long teacherId);
}
